package com.javabasic.algorithm.newcode;

import java.util.Scanner;

/**
 * @Author xiongmin
 * @Description TODO
 * @Date 2019/9/14 20:22
 * @Version 1.0
 **/
public class 数数 {
    static Scanner cin = new Scanner(System.in);
    static long MOD = 998244353;

    public static void main(String[] args) {
        int t = cin.nextInt();
        long result = 0;
        while (t-- > 0) {
            long n = cin.nextLong();
            if (n%2 == 0) {
                result = ((n+1)%MOD)*((n+1)%MOD)%MOD;
                result = ((n/2%MOD)*(n/2%MOD)%MOD)*result%MOD;
            } else {
                result = ((n+1)/2%MOD)*((n+1)/2%MOD)%MOD;
                result = ((n%MOD)*(n%MOD)%MOD)*result%MOD;
            }
            System.out.print(result + " ");

            result = 1;
            for (int i = 2; i <= n; i++) {
                result = (result*i)%MOD;
            }
            long qmod = qmod(result, 2 * n, MOD);
            System.out.print(qmod);
        }
    }

    private static long qmod(long a, long b, long mod) {
        long result = 1;
        a = a%mod;
        while (b > 0) {
            if ((b&1) == 1) {
                result = result*a%mod;
            }
            b >>= 1;
            a = a*a%mod;
        }
        return result;
    }
}
